package com.example;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.data.mongodb.repository.config.EnableMongoRepositories;

@SpringBootApplication
@EnableMongoRepositories(basePackages = {"com.example.repository"})
public class MorphiaExampleApplication {

	public static void main(String[] args) {
//		String uri = "mongodb://116.55.243.31:21017/test";
//		Datastore datastore = Morphia.createDatastore(MongoClients.create(uri), "test");
//        
//        // Configure the data store
//        datastore.getMapper().mapPackage("com.example.entities");
//        datastore.ensureIndexes();
//        
//        
//        Ingredient bread = new Ingredient("Bread");
//        Ingredient peanutButter = new Ingredient("Peanut Butter");
//        Ingredient jelly = new Ingredient("Jelly");
//        Ingredient flour = new Ingredient("Flour");
//        datastore.save(bread);
//        datastore.save(peanutButter);
//        datastore.save(jelly);
//        datastore.save(flour);
		
		SpringApplication.run(MorphiaExampleApplication.class, args);
	}
}
